///////////////////////////////////////////////////////////////////////////////////
// 通用组件封装
//开发人：虞胜强
//开发时间：2018/2/9
///////////////////////////////////////////////////////////////////////////////////
$(function () {
    $.fn.extend({
        'initXygCompBanner': function (bannerObje,paginationClass) {
			if(bannerObje==null||bannerObje==""){
				bannerObje=$(".xyg-comp-banner");
			}
			if(paginationClass==null||paginationClass==""){
				paginationClass=".xyg-comp-banner-swiper";
			}
			bannerObje.swiper({
				pagination: paginationClass,
				loop: true,
				autoplay: 3000
			});
        },
		'initXygCompLeftRightSlide': function (slideObje) {
			if(slideObje==null||slideObje==""){
				slideObje=$(".xyg-comp-left-right-slider");
			}
			slideObje.swiper({
				slidesPerView: 'auto',
        		centeredSlides: true,
        		spaceBetween: 10,
			});
        },
        'initXygCompBrandSlide': function (successFn,slideObje) {
            if(slideObje==null||slideObje==""){
                slideObje=$(".xyg-comp-brand-slide");
            }
            slideObje.swiper({
                slidesPerView: 4,
                slidesPerColumn:1,
                spaceBetween: 5
            });
            this.initXygCompBrandSlideBindClick(successFn);
        },
        'initXygCompBrandSlideBindClick': function (successFn,slideObje) {
            if(slideObje==null||slideObje==""){
                slideObje=$(".xyg-comp-brand-slide .xyg-comp-brand-slide_title");
            }
            slideObje.bind("click",function(){
                slideObje.removeClass("xyg-comp-brand-slide_active");
                $(this).addClass("xyg-comp-brand-slide_active");
                successFn($(this).attr("data-id"));
            });
        }
		
    });
});